import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AttendanceOutsiderVO, AttendanceOutsiderForm, AttendanceOutsiderQuery } from '@/api/dormitory/attendanceOutsider/types';

/**
 * 查询外来人员记录列表
 * @param query
 * @returns {*}
 */

export const listAttendanceOutsider = (query?: AttendanceOutsiderQuery): AxiosPromise<AttendanceOutsiderVO[]> => {
  return request({
    url: '/dormitory/attendanceOutsider/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询外来人员记录详细
 * @param id
 */
export const getAttendanceOutsider = (id: string | number): AxiosPromise<AttendanceOutsiderVO> => {
  return request({
    url: '/dormitory/attendanceOutsider/' + id,
    method: 'get'
  });
};

/**
 * 新增外来人员记录
 * @param data
 */
export const addAttendanceOutsider = (data: AttendanceOutsiderForm) => {
  return request({
    url: '/dormitory/attendanceOutsider',
    method: 'post',
    data: data
  });
};

/**
 * 修改外来人员记录
 * @param data
 */
export const updateAttendanceOutsider = (data: AttendanceOutsiderForm) => {
  return request({
    url: '/dormitory/attendanceOutsider',
    method: 'put',
    data: data
  });
};

/**
 * 删除外来人员记录
 * @param id
 */
export const delAttendanceOutsider = (id: string | number | Array<string | number>) => {
  return request({
    url: '/dormitory/attendanceOutsider/' + id,
    method: 'delete'
  });
};
